package com.xxx.video.mine.activitys;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import com.xxx.video.R;
import com.xxx.video.commen.activitys.BaseActivity;
import com.xxx.video.commen.utils.StatusBarUtil;
import com.xxx.video.commen.utils.StringUtils;
import com.xxx.video.commen.views.IosSingleChoosePopupWindow;
import com.xxx.video.mine.presenters.ICreationCenterView;

import java.util.ArrayList;

import butterknife.OnClick;

public class CreationCenterActivity extends BaseActivity implements ICreationCenterView {

    @Override
    public void initToolbarData() {
        super.initToolbarData();
        showActionBar();
        StatusBarUtil.getInstance().setStatusBarTransparent(this, true);
        setIsShowActionbarLine(true);
        setActionBarTitle(R.string.title_creation_center_activity);
    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_creation_center;
    }

    @Override
    public void initData(Bundle extras) {
        showRootLayoutStatus(1);
    }


    @OnClick({R.id.tv_creation_center_recording_management, R.id.tv_creation_center_video_management, R.id.tv_creation_center_add})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_creation_center_recording_management:
                startRecordingManagementActivity();
                break;
            case R.id.tv_creation_center_video_management:
                startVideoManagementActivity();
                break;
            case R.id.tv_creation_center_add:
                showCheckAddDialog();
                break;
            default:
                break;
        }
    }

    @Override
    public void startRecordingManagementActivity() {
        intent2Activity(RecordingManagementActivity.class);
    }

    @Override
    public void startVideoManagementActivity() {
        intent2Activity(VideoManagementActivity.class);
    }

    @Override
    public void showCheckAddDialog() {
        IosSingleChoosePopupWindow iosSingleChooseDialog = new IosSingleChoosePopupWindow(this);
        ArrayList<String> stringArrayList = new ArrayList<>();
        stringArrayList.add(StringUtils.getInstance().getString(R.string.dialog_choose_creation_center_add_audio));
        stringArrayList.add(StringUtils.getInstance().getString(R.string.dialog_choose_creation_center_add_video));
        iosSingleChooseDialog.setData(StringUtils.getInstance().getString(R.string.dialog_choose_creation_center_add_title),
                StringUtils.getInstance().getString(R.string.dialog_choose_creation_center_add_cancel), stringArrayList);
        iosSingleChooseDialog.setOnIosSingleChooseItemClickListener((string, position, type) -> {
            if (position == 0) {
                startAddAudioActivity();
            } else if (position == 1) {
                startAddVideoActivity();
            }
        });
        iosSingleChooseDialog.showAtLocation(getWindow().getDecorView());
        lightof();
        iosSingleChooseDialog.setOnDismissListener(this::lighton);
    }

    @Override
    public void startAddVideoActivity() {
        intent2Activity(AddVideoActivity.class);
    }

    @Override
    public void startAddAudioActivity() {
        intent2Activity(AddAudioActivity.class);
    }

    @Override
    public void showRootLayoutStatus(int status) {
        showLayoutStatus(1);
    }
}
